<!DOCTYPE html>
<html>
<head>
    <title>Node POST DATA TEST</title>
    <script src="/public/jquery-1.12.4.min.js"></script>
    <meta charset="utf-8">
    <script>
        $(function(){
            $('.formpg').click(function(){
                //$('.form_data').find('.active').removeClass('active');
                $('.active').removeClass('active');
                $(this).addClass('formpg active');
                var text = $(this).text();
                text = text.toLocaleLowerCase();
                //$('#form-'+text).toggle();
                $('.form_data').hide();
                $('#form-'+text).show();
                //$('.active').css({'color':'red'});                
            });
        });
    </script>
    <style>
        h4 a.active{color:red;}
    </style>
</head>
<body>
    <p>
        <h4>
            <a href="javascript:void(0);" class="formpg">POST</a> 
            <a href="javascript:void(0);" class="formpg">GET</a>数据到<a href="/httpbin">httpbin</a>
            <a href="JavaScript:window.print();" target="_self">打印</a>
        </h4></p>
    <form method="post" action="/httpbin" id="form-post" class="form_data">
        <br>Username: <input type="text" name="usename" required="required">
        <br>Password: <input type="password" name="password" required="required">
        <br><button type="submit">提交</button>
    </form>
    <form method="get" action="/httpbin"  id="form-get" style="display:none;background:green;" class="form_data">
        <br>Username: <input type="text" name="usename" required="required">
        <br>Password: <input type="password" name="password" required="required">
        <br><button type="submit">提交</button>
    </form>
</body>
</html>